package org.javabasics.io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.net.URLDecoder;

/**
 * Created by LUOLIANG on 2016/9/21.
 * 使用PrintStream处理流包装节点流
 */
public class PrintStreamTest {
    public static void main(String[] args) {
        String path = URLDecoder.decode(
                System.getProperty("user.dir") + "/basicsPractice/src/org/javabasics/io/");
        try (FileOutputStream fos = new FileOutputStream(path + "test.txt");
             PrintStream ps = new PrintStream(fos)) {
            ps.println("普通字符串");
            ps.println(new PrintStreamTest());
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
